// getCameraInformation.js
import axios from 'axios';
import { parseJsonData } from './jsonParser.js';
export function getCameraInformation(cameraId) {

    var host = window.location.hostname;

    return new Promise((resolve, reject) => {
        var config = {
            method: 'get',
            url: `http://`+host+`:8080/CameraInformation/getInformation?cameraid=${cameraId}`,
            headers: {}
        };

        axios(config)
            .then(function (response) {
                try {
                    const parsedData = parseJsonData(response.data);
                    resolve(parsedData);
                } catch (error) {
                    reject(error);
                }
            })
            .catch(function (error) {
                reject(error);
            });
    });
}